#include<bits/stdc++.h>
using namespace std;
const int MAXN=200005;
inline int Read() {
	int x=0,c=getchar(),f=1;
	for(; c<=47||c>=58; c=getchar())f=f&&(c^45);
	for(; c>=48&&c<=57; c=getchar())x=(x<<3)+(x<<1)+(c&15);
	return f?x:-x;
}
int n,fa[MAXN],cnt,dcnt,a[MAXN],l[MAXN],r[MAXN];
int Ffind(int x) {
	return x==fa[x]?x:fa[x]=Ffind(fa[x]);
}
void del() {
	int lst=2;
	bool Fprint=true;
	for(int i=Ffind(1),j=1; i<=n; ) {
		while(i<=n&&a[i]==lst) {
			while(j<=cnt&&r[j]<i)++j;
			i=Ffind(l[j+1]);
		}
		if(i>n)break;
		fa[i]=Ffind(i+1);
		lst=a[i];
		++dcnt;
		if(!Fprint)putchar(' ');
		printf("%d",i);
		Fprint=false;
	}
	putchar(10);
}
int main() {
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1; i<=n; ++i) {
		fa[i]=i;
		a[i]=Read();
		if(i==1||a[i]!=a[i-1])
			l[++cnt]=i;
		r[cnt]=i;
	}
	++cnt,l[cnt]=n+1,r[cnt]=n+1,fa[n+1]=n+1;
	for(int i=1; i<=n&&dcnt<n; ++i) {
		del();
	}
	return 0;
}
